<template>
	<view class="container">
		<view class="head">
			<text>运费：{{listdata.all_freight_amount?listdata.all_freight_amount:'暂无'}}</text>
		
			<text>配送费：{{listdata.all_delivery_amount}}</text>
			<text>垫资金额：{{listdata.all_advance_amount}}</text>
			<text>合计：{{listdata.all_amount}}</text>
		</view>
		<view class="list">
			<view class="list-item" @click="godetail(index)" v-for="(item,index) in carlist" :key="index">
				<view class="title">
					<text>{{item.tms_order_sn}}</text>
					<text style="color: #d80b17;font-weight: 400;" v-if="item.status==1">未扫码</text>
					<text style="color: #f89200;font-weight: 400;" v-if="item.status==2">已扫码</text>
					<text style="color: #008bf3;font-weight: 400;" v-if="item.status==3">已发车</text>
					<text style="color: #f400e0;font-weight: 400;" v-if="item.status==4">待配送</text>
					<text style="color: #0ACF00;font-weight: 400;" v-if="item.status==5">已送达</text>
				</view>
				<view class="body">
					<text>是否垫付：{{item.is_advance==0?'未垫付':'已垫付'}}</text>
					<text>吨数：{{item.all_weight}}吨</text>
					<text>是否配送：{{item.is_delivery==0?'是':'否'}}</text>
					<text>车牌号：{{item.car_plate || ''}}</text>
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listdata:{
					all_freight_amount:'',
					all_delivery_amount:'',
					all_advance_amount:'',
					all_amount:'',
					wid:'',
					waybill_sn:''
					
				},
				carlist:''
			};
		},
		onLoad(opt) {
		console.log(opt.listdata)
		this.listdata=JSON.parse(opt.listdata)
		},
		onShow() {
		this.getcarlist()	
		},
		methods:{
			//运单列表
			getcarlist(){
				this.$orderlist({
					waybill_id:this.listdata.wid
					
				}).then(res=>{
					if(res.code!=1){
						this.$toast(res.msg)
					}
					this.carlist=res.data.data
					console.log(this.carlist)
				})
			},
			godetail(index){
				let orderdetail=this.carlist[index]
				uni.navigateTo({
					url:'/pages/prodetail/prodetail?detail='+JSON.stringify(orderdetail)
				})
			}
		}
	}
</script>

<style lang="scss">
.container{
	.list{

		.list-item{
			margin-top: 20rpx;
			padding: 30rpx;
			background-color: #fff;
			box-shadow: 0px 0px 4px 0px rgba(204,204,204,0.5);
			// border-radius: 16rpx;
			margin-bottom: 30rpx;
			.body{
				display: flex;
				flex-wrap: wrap;
				// justify-content: space-between;
				text{
					font-size: 32rp;
					width: 40%;
					margin-top: 20rpx;
				}
			}
			.title{
				display: flex;
				padding: 0 0 30rpx 0;
				border-bottom: #ccc 1px dashed;
				justify-content: space-between;
				text{
					font-size: 36rpx;
					color: #000;
					font-weight: 600;
				}
			}
		}
	}
	.head{
		margin-top: 20rpx;
		display: flex;
		justify-content: space-around;
		padding: 30rpx;
		flex-wrap: wrap;
		background-color: #fff;
		text{
			font-size: 32rpx;
			width: 40%;
			margin-bottom: 20rpx;
		}
	}
}
</style>
